package org.chuan.hisports.controller;


import org.chuan.hisports.entity.Member;
import org.chuan.hisports.service.MemberService;
import org.chuan.hisports.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller("member")
@RequestMapping("member")
public class MemberController {
    @Autowired
    MemberService memberService;

    @RequestMapping("select")
    @ResponseBody
    public JSONResult select(String uid){
        Member member = memberService.select(uid);
        return JSONResult.build(200,"success",member);
    }
    @ResponseBody
    @RequestMapping("addTime")
    public String addTime(String uid,String month){
        memberService.updateLevel(uid, month);
        return "success";
    }
    @ResponseBody
    @RequestMapping("selectTime")
    public String selectTime(String uid){
        String lastTime = memberService.selectLastTime(uid);
        return lastTime;
    }
}
